package com.bw.doctor.controller;
/**
 * @Author：尚志豪
 * @Package：com.bw.doctor.controller
 * @Project：doudi-group2-shixun-02
 * @name：PharmacyHistoricalPrescriptionController
 * @Date：2025/2/25 20:29
 */


import com.alibaba.nacos.api.model.v2.Result;
import com.bw.common.core.domain.R;
import com.bw.common.core.web.controller.BaseController;
import com.bw.doctor.domain.res.PrescriptionParameterRes;
import com.bw.doctor.service.PharmacyHistoricalPrescriptionService;
import com.bw.domain.PatientInformation;
import com.bw.domain.Prescription;
import com.bw.domain.res.HistoricalPrescriptionRes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: doudi-group2-shixun-02
 * @description: 我的药房历史处方
 * @author: CuiFu Bo
 * @create: 2025-02-25 20:29
 **/
@RestController
@RequestMapping("/pharmacyHistoricalPrescription")
public class PharmacyHistoricalPrescriptionController extends BaseController
{

    @Autowired
    private PharmacyHistoricalPrescriptionService pharmacyHistoricalPrescriptionService;

    /**
     * B端 我的药房 历史处方列表
     */
    @PostMapping("/listOfHistoricalPrescriptions/{doctorId}")
    public List<com.bw.domain.res.HistoricalPrescriptionRes> listOfHistoricalPrescriptions(@PathVariable Long doctorId)
    {
        List<com.bw.domain.res.HistoricalPrescriptionRes> list = pharmacyHistoricalPrescriptionService.listOfHistoricalPrescriptions(doctorId);
        System.out.println("历史处方列表:=======" + list.size());
        return list;
    }

    /**
     * B端 我的药房 历史处方详情
     */
    @PostMapping("/historicalPrescriptionDetails/{id}")
    public Result<HistoricalPrescriptionRes> historicalPrescriptionDetails(@PathVariable Long id)
    {
        com.bw.domain.res.HistoricalPrescriptionRes historicalPrescriptionRes = pharmacyHistoricalPrescriptionService.historicalPrescriptionDetails(id);
        return Result.success(historicalPrescriptionRes);
    }

    /**
     * B端 我的药房 开处方
     */
    @PostMapping("/makeAPrescriptionAdd")
    public R makeAPrescriptionAdd(@RequestBody PrescriptionParameterRes parameterRes)
    {
        return pharmacyHistoricalPrescriptionService.makeAPrescriptionAdd(parameterRes);
    }

    /**
     * B端 我的药房 通过医生查看病症
     */
    @PostMapping("/seeYourDoctorForSymptoms/{doctorId}")
    public List<Prescription> seeYourDoctorForSymptoms(@PathVariable Long doctorId)
    {
        return pharmacyHistoricalPrescriptionService.seeYourDoctorForSymptoms(doctorId);
    }

    /**
     * B端 我的药房 通过id查询患者信息
     */
    @PostMapping("/queryPatientInformationById/{patientInformationId}")
    public PatientInformation queryPatientInformationById(@PathVariable Long patientInformationId)
    {
        return pharmacyHistoricalPrescriptionService.queryPatientInformationById(patientInformationId);
    }
}
